<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
		}
		.father{
			width: 300px;
			height: 300px;
			background: skyblue;
			position: relative;
			top: 50px;
			left: 50px;
			margin: 50px;
			/*padding: 20px;
			margin: 20px;
			border: 5px solid black;*/
			
		}
		.son{
			width: 70px;
			height: 70px;
			background: pink;
			position: absolute;
			/*padding: 10px;
			margin: 10px;
			border: 5px solid black;*/
			
		}
	</style>
</head>
<body>
	<div class="father">
		<div class="son">
			
		</div>
	</div>
	<script type="text/javascript">
		var son = document.querySelector('.son')

		//偏移量 
		console.log('对于左侧的偏移量',son.offsetLeft)
		console.log('对于顶部的偏移量',som.offsetTop)
		//在不脱标的情况下 offsetLeft/offsetTop 偏移量取决与父元素的margin,padding,border  和子元素的margin

		//在脱标的情况下 偏移量只取决于自身的left,top + margin\
	</script>
</body>
</html>